#!/usr/bin/python
  
from ctypes import *
import os

#Define float variables, In Python, don't neet data type keyword.
f1 = 1.2
f2 = 3.1

#import C shared library 'Cfunc.so' & named 'libCfunc'
libCfunc = cdll.LoadLibrary(os.getcwd() + '/Cfunc.so') 
'''
declare C function 'fadd' returned parameter's data type is 'c_double'.
declare C function 'fadd' argments' data type is 'c_float'.
'''
libCfunc.fadd.restype = c_double
libCfunc.fadd.argtypes = [c_float, c_float]

#Call C function 'display' in shared library 'Cfunc.so'
libCfunc.display('Hello, Python call C routines...') 

#Call C function 'fadd' in shared library 'Cfunc.so'
print libCfunc.fadd(f1, f2)